﻿using System;
using Dgg.LearnYourTools.NUnit.C_Assertions.Support;
using NUnit.Framework;

namespace Dgg.LearnYourTools.NUnit.C_Assertions.a_Exceptions
{
	[TestFixture]
	public class _021_ConstraintModel
	{
		[Test]
		public void RangeCtor_UnorderedBounds_Exception_UsingConstraints()
		{
			Assert.That(() => new Range<int>(5, 1), Throws.InstanceOf<ArgumentOutOfRangeException>());
		}

		[Test]
		public void RangeCtor_UnorderedBounds_Exception_HandlingWithConstraints()
		{
			Assert.That(() => new Range<int>(-1, -5), Throws.InstanceOf<ArgumentOutOfRangeException>()
				.With.Message.StringContaining("-5")
				.With.Property("ParamName").EqualTo("upperBound")
				.With.Property("ActualValue").EqualTo(5));
		}
	}
}
